#pragma once
#include "BlueprintScriptLibrary/RegistAction.h"
#include "GraphBase.h"

class ForLoopGraph : public GraphBase
{
public:
    ForLoopGraph() { graphName = "ForLoop"; }
    bool OnInit();
    virtual void ParseXmlElement(class TiXmlElement* ele);
    bool SetAttribute(const char* attrName, const char* attrVal);
    void OnDraw();

    virtual void onMouseButtonDown(int button, int x, int y);
    void onMouseMove(int x, int y);
    void onMouseButtonUp(int button, int x, int y);
    BlueprintScriptLibrary::Class* GetClass();
    Vec2vbi GetOutputPinPos(int index);
    VarBaseInt GetInputPinNum() { return 1; }
    VarBaseInt GetOuputPinNum() { return 2; }

    void Execute();
    FunctionPin* GetFunctionPin();
    void ConnectTo(GraphBase* graph, int index = 0);
    ForLoopPin* flp;
    GraphBase* loopBody;
    GraphBase* complete;
    VarBaseInt startIndex{0};
    VarBaseInt endIndex{1};

    VarBaseInt loopBodyGraphId;
    VarBaseInt completeGraphId;
    class InputPin* ipp{nullptr};
    class OutputPin* loopBodyOpp;
    OutputPin* compeleteOpp;
};
RegisterBlueprintClass(ForLoopGraph)
